package com.eight.travel.config;

import com.eight.travel.interceptor.MyInterceptor;
import io.swagger.annotations.Api;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author Q小旭
 * @version 1.0
 */
@Api(value = "拦截器")
public class MyWebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new MyInterceptor()).addPathPatterns("/**").excludePathPatterns("/user/**");
    }

    //配置全局跨域
//    @Override
//    public void addCorsMappings(CorsRegistry registry) {
//        registry.addMapping("/**").allowCredentials(true).allowedOrigins("*");
//    }
//配置全局的跨域处理
//    @Override
//    public void addCorsMappings(CorsRegistry registry) {
//    registry.addMapping("/**").allowCredentials(true).allowedOrigins("*");
//    }
}
